package tec.code;

public class FormatUtil {
	public static String formatByte(byte b) {
		String hex = "0" + Integer.toHexString(b);
		return((hex.substring(hex.length() - 2, hex.length())).toUpperCase());
	}
	
	public static String formatByte(byte[] bytes) {
		return(formatByte(bytes, ""));
	}
	
	public static String formatByte(byte[] bytes, String seperator) {
		String s = "";
		for(int i=0; i<bytes.length; i++) s += formatByte(bytes[i]) + seperator;
		s = (s.length() >= seperator.length() ? s.substring(0, s.length() - seperator.length()) : s);
		return(s);
	}	
}
